#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;
int findMaxLength(vector<int>& nums)
{
    unordered_map<int, int>hash;
    int sum = 0;
    int count = 0;
    hash[0] = -1;
    for (int i = 0; i < nums.size(); i++)
    {
        sum += nums[i] == 0 ? -1 : 1;
        if (hash.count(sum))
        {
            count = max(count, i - hash[sum]);
        }
        else
        {
            hash[sum] = i;
        }
    }
    return count;
}


int main()
{

    return 0;
}
